from runserver import app

from flask import request
from flask_restful import Resource
import time
db = app.get_db()
api = app.get_api()
print('hello,world')
class user(db.Model):
    __tablename__ = "user"
    user_id = db.Column(db.Integer,primary_key=True)
    username = db.Column(db.String)
    password = db.Column(db.String)
    sex = db.Column(db.String)
    department = db.Column(db.String)
    manager = db.Column(db.String)
    date = db.Column(db.Date)
class  userApi(Resource):
    def post(self):
        db.session.begin()
        user_info = user(username=request.form['username'],password=request.form['password'],sex=request.form['sex'],department=request.form['department'],manager=request.form['manager'],date=time.strftime('%Y%m%d'))
        print(user_info)
        db.session.add(user_info)
        db.session.commit()
        db.session.close()
        return "注册成功"
    def get(self):
        pass
    def delete(self):
        pass
    def put(self):
        pass
    def options(self):
        pass






